import { Effect, ImmerReducer, Reducer, Subscription } from 'umi';

export interface IndexModelState {
  collapsed: boolean;
}

export interface IndexModelType {
  namespace: 'index';
  state: IndexModelState;
  effects: {};
  reducers: {
    changeCollapsed: Reducer;
  };
  subscriptions: { setup: Subscription };
}

const IndexModel: IndexModelType = {
  namespace: 'index',

  state: {
    collapsed: false,
  },

  effects: {
    //   *query({ payload }, { call, put }) {},
  },
  reducers: {
    changeCollapsed(state) {
      return {
        ...state,
        collapsed: !state.collapsed,
      };
    },
  },
  subscriptions: {
    setup({ dispatch, history }) {},
  },
};

export default IndexModel;
